<?php

namespace App\Controller\Admin\Ocean;

use App\Dao\Ocean\OceanRankingSettingDao;
use App\Middleware\AuthTokenMiddleware;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Middleware;
use Yj\Apidog\Annotation\ApiController;
use Yj\Apidog\Annotation\FormData;
use Yj\Apidog\Annotation\PostApi;

/**
 * @ApiController(prefix="admin/ocean/ranking/setting")
 */
class RankingSettingController extends \App\Controller\Admin\BaseController
{

    /**
     * @Inject()
     * @var OceanRankingSettingDao
     */
    protected $oceanRankingSettingDao;

    /**
     * @PostApi(path="lists")
     */
    public function lists(){
        $params = $this->getParams();
        $data  =$this->oceanRankingSettingDao->lists($params);
        _SUCCESS($data);
    }

    /**
     * @PostApi(path="add")
     * @FormData(key="rank")
     * @FormData(key="reward")
     */
    public function add(){
        $params = $this->getParams();
        $this->oceanRankingSettingDao->add($params);
        _SUCCESS();
    }

    /**
     * @PostApi(path="edit")
     * @FormData(key="rank")
     * @FormData(key="id")
     * @FormData(key="reward")
     */
    public function edit(){
        $params = $this->getParams();
        $this->oceanRankingSettingDao->edit($params->get('id'),$params->except('id'));
        _SUCCESS();
    }

    /**
     * @PostApi(path="delete")
     * @FormData(key="id")
     */
    public function del(){
        $params = $this->getParams();
        $this->oceanRankingSettingDao->del($params->get('id'));
        _SUCCESS();
    }

}